import type { PositionAddOrUpdateRequest, PositionAddResponse, PositionDetailResponse, PositionListQuery, PositionListResponse } from "./type"
import { request } from "@/http/axios"

export function getTeacherPositionListApi(params: PositionListQuery) {
  return request<PositionListResponse>({
    url: "/position/teacher/page",
    method: "post",
    data: params
  })
}

/**
 * 教师端获取职位详情
 * @param positionId 职位ID
 * @returns 职位详情
 */
export function getPositionDetailForTeacherApi(positionId: number) {
  return request<PositionDetailResponse>({
    url: `/position/teacher/detail/${positionId}`,
    method: "get"
  })
}

/**
 * 新增职位
 * @param reqVo 职位新增数据
 * @returns 操作结果
 */
export function addPositionApi(reqVo: PositionAddOrUpdateRequest) {
  return request<PositionAddResponse>({
    url: "/position",
    method: "post",
    data: reqVo
  })
}

/**
 * 更新职位
 * @param reqVo 职位更新数据
 * @returns 操作结果
 */
export function updatePositionApi(reqVo: PositionAddOrUpdateRequest) {
  return request<PositionAddResponse>({
    url: "/position",
    method: "put",
    data: reqVo
  })
}
